/**
 *Copyright (c) 2024 watereyes
 * safetymanagement is licensed under Mulan PubL v2.
 * You can use this software according to the terms and conditions of the Mulan
 * PubL v2.
 * You may obtain a copy of Mulan PubL v2 at:
 *          http://license.coscl.org.cn/MulanPubL-2.0
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 * See the Mulan PubL v2 for more details.
 */
package com.koron.system.mapper;


import com.koron.system.domain.District;
import com.koron.system.domain.DistrictCorpRelation;
import org.apache.ibatis.annotations.Param;
import org.koron.ebs.mybatis.EnvSource;

import java.util.List;


public interface DistrictMapper {

    /**
     * 新增片区
     * @param district
     * @return
     */
    Integer insertDistrict(@Param("district") District district);

    /**
     * 修改片区
     * @param district
     * @return
     */
    Integer updateDistrict(@Param("district") District district);

    /**
     * 根据主键删除片区
     * @param id
     * @return
     */
    Integer deleteDistrict(@Param("id") String id);

    /**
     * 根据主键获取片区信息
     * @param id
     * @return
     */
    District queryOneDistrict(@Param("id") String id);

    /**
     * 根据code查询片区信息
     * @param code
     * @return
     */
    District queryOneDistrictByCode(@Param("code") String code);

    /**
     * 查询片区信息列表
     * @param start
     * @param rows
     * @return
     */
    List<District> queryAllDistrict(@Param("start") Integer start,@Param("rows") Integer rows);

    /**
     * 统计片区
     * @return
     */
    Integer countTotalDistrict();

    /**
     * 批量新增片区与水司之间的关联
     * @param districtCorpRelationList
     * @return
     */
    Integer batchInsertDistrictCorp(@Param("districtCorpRelationList") List<DistrictCorpRelation> districtCorpRelationList);

    /**
     * 批量删除水司与片区之间的关联
     * @param idList
     * @return
     */
    Integer batchDeleteDistrictCorp(@Param("idList") List<String> idList);

    /**
     * 批量查询水司与片区之间的关联
     * @param idList
     * @return
     */
    List<DistrictCorpRelation> batchQueryDistrictCorp(@Param("idList") List<String> idList);


    /**
     * 根据片区编码删除所有的水司和片区之间的关联
     * @param ditrictCode
     * @return
     */
    Integer deleteDistrictCorp(@Param("ditrictCode") String ditrictCode);

    /**
     * 根据片区编码查询该片区下有多少水司
     * @param ditrictCode
     * @param start
     * @param rows
     * @return
     */
    List<DistrictCorpRelation> queryDistrictCorp(@Param("ditrictCode") String ditrictCode,@Param("start") Integer start,@Param("rows") Integer rows);

    /**
     * 根据片区编码统计该片区下有多少水司
     * @param ditrictCode
     * @return
     */
    Integer countDistrictCorp(@Param("ditrictCode") String ditrictCode);

    /**
     * 根据水司code获取水司与片区的信息
     * @param corpCode
     * @return
     */
    DistrictCorpRelation queryDistrictCorpByCorpCode(String corpCode);
}
